package com.zhouyou.http.demo.view;

import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observable;
import ohos.agp.components.Component;

import static com.zhouyou.http.utils.Utils.checkNotNull;

public class RxView {


    /**
     * Create an observable which emits on {@code view} click events. The emitted value is
     * unspecified and should only be used as notification.
     * <p>
     * <em>Warning:</em> The created observable keeps a strong reference to {@code view}. Unsubscribe
     * to free this reference.
     * <p>
     * <em>Warning:</em> The created observable uses {@link Component#setClickedListener} to observe
     * clicks. Only one observable can be used for a view at a time.
     */
    public static Observable<Object> clicks(@NonNull Component view) {
        checkNotNull(view, "view == null");
        return new ViewClickObservable(view);
    }

}
